package com.lzs.bootsafety.business.sys.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lzs.bootsafety.business.sys.entity.SysDict;
import com.lzs.bootsafety.business.sys.mapper.SysDeptMapper;
import com.lzs.bootsafety.business.sys.mapper.SysDictMapper;
import com.lzs.bootsafety.business.sys.service.SysDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.List;
@Service
public class SysDictServiceImpl implements SysDictService {
    public static HashMap<String, String> hashMap = new HashMap<>();
    @Autowired
    private SysDictMapper sysDictMapper;
    @Override
    public List<SysDict> getSysDict(String dictType) {
        return sysDictMapper.selectSysDict(dictType);
    }

    @Override
    public PageInfo<SysDict> getDictList(SysDict sysDict) {
        Integer page = sysDict.getPage();
        Integer limit = sysDict.getLimit();
        PageHelper.startPage(page = page == null ? 1 : page,limit = limit == null ? 10 : limit);
        List<SysDict> sysDictList = sysDictMapper.selectDictList(sysDict);
        return new PageInfo<SysDict>(sysDictList);
    }

    @Override
    public int addSelective(SysDict record) {
        return sysDictMapper.insertSelective(record);
    }

    @Override
    public int modifyByPrimaryKeySelective(SysDict record) {
        return sysDictMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int delByPrimaryKey(Long[] dictIds) {
        return sysDictMapper.deleteByPrimaryKey(dictIds);
    }

    @Override
    public SysDict getByPrimaryKey(Long dictId) {
        return sysDictMapper.selectByPrimaryKey(dictId);
    }

}
